using Architecture.Repository.Interface;

namespace Architecture.Domain.Services;

public class UserInfoService : IUserInfoService
{
    private readonly IUserInfoRepository _userInfoRepository;

    public UserInfoService(IUserInfoRepository userInfoRepository)
    {
        _userInfoRepository = userInfoRepository;
    }

    public async Task<UserInfo> GetUserInfo(UserInfo userinfo)
    {
        var result =
            await _userInfoRepository.GetAsync(p => p.UserName == userinfo.UserName && p.Password == userinfo.Password);
        return result==null? new UserInfo():result.FirstOrDefault();
    }
}